class MyNewException < Exception
end
#raise MyNewException, "some new kind of error has occured"

class InvalidLineError < StandardError
end

def line_from_file(filename, substring)
	fh = File.open(filename)
	line = fh.gets
	raise InvalidLineError unless line.include?(substring)
	return line
	rescue InvalidLineError
		puts "Invalid line!"
		raise
	ensure
		fh.close
end

line_from_file("D:\\ez.json","abc")